package com.redhipps.hips.client.model;

import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;


public class ModelRepository<T extends Model> implements Iterable<T> {

  private Map<PythonDatastoreKey, T> entries;

  public ModelRepository(Collection<T> models) {
    entries = new HashMap<PythonDatastoreKey, T>();
    load(models);
  }

  private void load(Collection<T> models) {
    for (T model : models) {
      //entries.put(model.key(), model);
    }
  }

  public int size() {
    return entries.size();
  }

  public T get(PythonDatastoreKey key) {
    return entries.get(key);
  }

  public Iterator<PythonDatastoreKey> keyIterator() {
    return entries.keySet().iterator();
  }

  public Iterator<T> iterator() {
    return entries.values().iterator();
  }
}
